var add_form_panels = Ext.create("Ext.form.Panel", {
	url: "/fk-acti/form/add",
	buttonAlign: "center",
	bodyStyle: "padding: 10px;",
	defaultType: "textfield",
	id: "formMain",
	width: 450,
	items: [{
			fieldLabel: "表单名称",
			emptyText: "",
			name: "name",
			allowBlank : false,
			width: "100%"
		},{
			fieldLabel: "表单类型Id",
			name: "type_kid",
			hidden: true,
			id:"type_kid",
			width: "100%"
		},{
			fieldLabel: "编号",
			emptyText: "排序使用",
			name: "code",
			allowBlank : false,
			width: "100%"
		}
	],
	buttons: [{
		text: "保存",
		formBind: true, // only enabled once the form is valid
		disabled: true,
		handler: function() {
			var form = this.up("form").getForm();
			if (form.isValid()) {
				form.submit({
					waitMsg: "保存中...",
					success: function(form, action) {
						Ext.Msg.alert("提示", action.result.result);
						add_form_panel_wins.close();
						dataStore.load();
					},
					failure: function(form, action) {
						Ext.Msg.alert("提示", "操作失败！");
					}
				});
			}
		}
	}]
});

var add_form_panel_wins = Ext.create("Ext.Window", {
	title: "新增表单",
	closeAction: "hide",
	items: add_form_panels,
});

function myAdd(kid) {
	add_form_panels.getForm().reset();
	Ext.getCmp("type_kid").setValue(kid);
	add_form_panel_wins.show();
	add_form_panels.getForm().isValid();
}
